const express = require('express')
const app=express()
  //设置允许跨域访问
  app.all('*', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "*");
    res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE");
    res.header("X-Powered-By",' 3.2.1')
    res.header("Content-Type", "application/json;charset=utf-8");
    next();
  });
  app.post('/network/login',(req,res)=>{
    req.on('data',function(data){
      obj=JSON.parse(data);
      if (obj.username == '1' && obj.password == '1') {
        res.send('1');
      }else {
        res.send('0')
      }
    })
  })

  app.listen(8081,()=>{
    console.log("8081已开启");
  })


